<?php
/**
 * 商城相关接口
 * */

namespace App\Http\Controllers;

use App\Http\Model\Hint;
use App\Http\Model\OutJson;

use App\Http\Services\MallMainServices;
use Illuminate\Http\Request;


class MallMainController extends BaseController
{

    private $service;


    public function __construct(MallMainServices $MallMainServices)
    {
        $this->service = $MallMainServices;
    }

    /**
     * 添加楼层 -后台使用
     */
    public function addMain(Request $request)
    {
        $params = $request->input();

        $res = $this->service -> addMain($params);
        echo json_encode($res);
    }
    public function editMain(Request $request)
    {
        $params = $request->input();

        $res = $this->service -> editMain($params);
        echo json_encode($res);
    }
    public function delMain(Request $request)
    {
        $params = $request->input();
        $res = $this->service -> delMain($params);
        echo json_encode($res);
    }

    /**
     * 楼层列表
     */
    public function listMain(Request $request)
    {
        $params = $request->input();
        $res = $this->service -> listMain($params);
        echo json_encode($res);

    }


    /**
     * 添加楼层元素 -后台使用
     */
    public function addItem(Request $request)
    {
        $params = $request->input();

        $res = $this->service -> addItem($params);
        echo json_encode($res);
    }
    public function editItem(Request $request)
    {
        $params = $request->input();

        $res = $this->service -> editItem($params);
        echo json_encode($res);
    }
    public function delItem(Request $request)
    {
        $params = $request->input();
        $res = $this->service -> delItem($params);
        echo json_encode($res);
    }

    /**
     * 元素列表
     */
    public function listItem(Request $request)
    {
        $params = $request->input();
        $res = $this->service -> listItem($params);

        echo json_encode($res);
    }



    /********************************客户端API************************************************/

    /**
     * 获取商城楼层
     */
    public function getMallMain(Request $request)
    {
        $params = $request->input();
        $params['user_id'] = $this -> getLoginUserId();

        $res = $this->service -> getMallMain($params);
        echo json_encode($res);
    }




}
